﻿<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Activity_Preview_Grid.aspx.vb" Inherits="PubProject.Activity_Preview_Grid" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title></title>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<script language="javascript" src="/_controls/settings.aspx"></script>
		<link rel="stylesheet" type="text/css" href="/_grid/map_grid.css">
		<link rel="stylesheet" type="text/css" href="/_common/styles/global.css">
		<link rel="stylesheet" type="text/css" href="/_nav/taskbox.css">
		<link rel="stylesheet" type="text/css" href="/_nav/menu.css">
		<link rel="stylesheet" type="text/css" href="/_forms/styles/form.css">
		<link rel="stylesheet" type="text/css" href="/_controls/find/find.css">
		<script language="javascript" src="/_common/scripts/global.js"></script>
		<script language="javascript" src="/_controls/find/find.js"></script>
		<script language="javascript" src="/_controls/util/util.js"></script>
		<script language="javascript" src="/_controls/datetime/date.js"></script>
		<script language="javascript" src="/_controls/number/number.js"></script>
		<script language="javascript" src="/_nav/menu.js"></script>
		<script language="javascript">
		
		function RepeatClick(sLocation)
		{
			openMyDlg("重复客户", "/PubProject/Activity/Activity_Preview_Grid_Detail.aspx", "Location=" + escape(sLocation) + "&Type=" + escape(__txtType.value) + "&MainTable=" + escape(__MainTable.value), "",600, 500);
		}
		function window.onload()
		{
            var sSortField = document.all.txtSortField.value;
            var sSortMode = document.all.txtSortMode.value;
            var sCount = document.all.dgdMain.children[0].children[0].cells.length;
            
            for(i=0;i<sCount;i++)
            {
                if(document.all.dgdMain.children[0].children[0].cells[i].innerText==sSortField)
                {
                    var imgObject = document.createElement("img"); 
                    if (sSortMode=="ASC")
                    {
                        imgObject.src = '/_imgs/bar_up.gif';
                    }
                    else
                    {
                        imgObject.src = '/_imgs/bar_down.gif'; 
                    }
                    
                    document.all.dgdMain.children[0].children[0].cells[i].appendChild(imgObject); 
                }
            }
            
            //          以下是准备要删除的,测试时使用。
            //		    var txtSQLList = document.all.txtSql.value.split(";");
            //		    var txtFilter = document.all.txtFilter.value;
            //		    var i=0;
            //		    var outPut="";
            //		    var count=1;
            //		    
            //		    if(txtSQLList.length<2)
            //		    {
            //		        return;
            //		    }
            //		    
            //		    for(i=0;i<txtSQLList.length;i++)
            //			{
            //			    var txtSQL=txtSQLList[i];

            //			    if(txtSQL.indexOf("select newid()")>-1)
            //			    {
            //			        outPut+="第" + count + "步：查询条件语句。\n" + "SQL条件如下：" + txtFilter + "\n\n";
            //			        count++;
            //			    }
            //			    
            //			    if(txtSQL.indexOf("where buguid='")>-1)
            //			    {
            //			        outPut+="第" + count + "步：公司过滤。\n" + "SQL条件如下：BUGUID='当前公司'\n\n";
            //			        count++;
            //			    }
            //			    
            //			     if(txtSQL.indexOf("isreceivesms=1")>-1)
            //			    {
            //			        outPut+="第" + count + "步：过滤不接收短信的客户）。\n" + "SQL条件如下：isreceivesms=1\n\n";
            //			        count++;
            //			    }
            //			    
            //			     if(txtSQL.indexOf("delete #ActivityPreviewTmp where #ActivityPreviewTmp.id<>(select top 1 id from #ActivityPreviewTmp d where d.[客户名称] = #ActivityPreviewTmp.[客户名称] and d.手机号码")>-1)
            //			     {
            //			        outPut+="第" + count + "步：删除客户名称和手机号码相同的记录，但是保留一个。\n" + txtSQL +"\n\n";
            //			        count++;
            //			     }
            //			     
            //	            if(txtSQL.indexOf("delete #ActivityPreviewTmp where #ActivityPreviewTmp.id<>(select top 1 id from #ActivityPreviewTmp d where d.[客户名称] = #ActivityPreviewTmp.[客户名称] and d.Email")>-1)
            //			     {
            //			        outPut+="第" + count + "步：删除客户名称和Email相同的记录，但是保留一个。\n" + txtSQL +"\n\n";
            //			        count++;
            //			     }
            //			     
            //			     if(txtSQL.indexOf("delete #ActivityPreviewTmp where [手机")>-1)
            //			     {
            //			        outPut+="第" + count + "步：删除手机号码为空或者为NULL的数据。\n" + txtSQL +"\n\n";
            //			        count++;
            //			     }
            //			     
            //			     if(txtSQL.indexOf("delete #ActivityPreviewTmp where [Email")>-1)
            //			     {
            //			        outPut+="第" + count + "步：删除Email为空或者为NULL的数据。\n" + txtSQL +"\n\n";
            //			        count++;
            //			     }
            //			     
            //			     if(txtSQL.indexOf("delete #ActivityPreviewTmp where [客户名称] is null")>-1)
            //			     {
            //			        outPut+="第" + count + "步：删除客户名称为空的数据。\n" + txtSQL +"\n\n";
            //			        count++;
            //			     }
            //			     
            //			      if(txtSQL.indexOf("update #ActivityPreviewTmp set [重复]='*'")>-1)
            //			      {
            //			        outPut+="第" + count + "步：标识出相同联系方式大于1的客户。\n" + txtSQL +"\n\n";
            //			        count++;
            //			      }
            //			      
            //			      if(txtSQL.indexOf("WHILE @@FETCH_STATUS=0")>-1)
            //			      {
            //			        outPut+="第" + count + "步：相同联系方式只保留一条。\n" + txtSQL +"\n\n";;
            //			        count++;
            //			      }
            //			}
            //		    alert(outPut);
		}
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<asp:textbox id="txtSql" style="DISPLAY: none" runat="server"></asp:textbox>
			<asp:textbox id="txtFilter" style="DISPLAY: none" runat="server"></asp:textbox>
			<asp:textbox id="txtSortMode" style="DISPLAY: none" runat="server">ASC</asp:textbox>
			<asp:textbox id="txtSortField" style="DISPLAY: none" runat="server">客户名称</asp:textbox>
			<asp:literal id="Literal1" runat="server"></asp:literal>
			<TABLE height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
				<TR>
					<TD colSpan="2" align="center">
						<div class="scrolbar" style="BORDER-RIGHT: #cccccc 0px solid; BORDER-TOP: #cccccc 0px solid; FONT-WEIGHT: bold; FONT-SIZE: 10pt; OVERFLOW: auto; BORDER-LEFT: #cccccc 0px solid; WIDTH: 810px; COLOR: blue; BORDER-BOTTOM: #cccccc 0px solid; HEIGHT: 250px; TEXT-ALIGN: center">
							<asp:datagrid id="dgdMain" runat="server" Width="100%" BackColor="#F4FAED" BorderColor="Silver"
								BorderWidth="1px" PageSize="15" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="True">
								<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
								<HeaderStyle HorizontalAlign="Center" ForeColor="Lavender" VerticalAlign="Middle" BackColor="#7288AC"></HeaderStyle>
								<PagerStyle Visible="False"></PagerStyle>
							</asp:datagrid>
						</div>
					</TD>
				</TR>
				<TR>
					<TD style="WIDTH: 448px">页次：
						<asp:label id="lblCurrentPage" runat="server">1/3</asp:label>&nbsp;&nbsp;&nbsp; 
						每页<asp:label id="Label3" runat="server">15</asp:label>条&nbsp;&nbsp;&nbsp; 共<asp:label id="lblTotal" runat="server"></asp:label>条</TD>
					<TD align="right">
						<asp:linkbutton id="lbtnFirst" runat="server" ForeColor="Navy" CommandArgument="fist">[首页]</asp:linkbutton>&nbsp;
						<asp:linkbutton id="lbtnPrev" runat="server" ForeColor="Navy">[前页]</asp:linkbutton>&nbsp;
						<asp:linkbutton id="lbtnNext" runat="server" ForeColor="Navy">[后页]</asp:linkbutton>&nbsp;
						<asp:linkbutton id="lbtnLast" runat="server" ForeColor="Navy">[尾页]</asp:linkbutton>&nbsp;&nbsp;
						</TD>
				</TR>
			</TABLE>
		</form>
	</body>
</HTML>
